<template>
  <a-table
    ref="table"
    size="middle"
    bordered
    rowKey="id"
    :columns="columns"
    :dataSource="dataSource"
    :pagination="ipagination"
    :loading="loading"
    @change="handleTableChange"
    :class="{antableClass:notClass}"
  >
    <template slot="action" slot-scope="text, record">
      <a @click="CheckDetail(record)">详情</a>
    </template>
  </a-table>
</template>

<script>
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
export default {
  props: {
    list: {
      type: String,
      default: ''
    },
    columns: {
      type: Array,
      default: []
    },
    param: {
      type: Object,
      default: () => ({
        orgId: '',
        proId: ''
      })
    },
    reload: {
      type: Boolean,
      default: false
    },
    reload2: {
      type: Boolean,
      default: false
    },
    notClass:{
      type: Boolean,
      default: true
    }
  },
  mixins: [JeecgListMixin],
  beforeMount() {
    this.url.list = this.list
    this.queryParam = Object.assign({}, this.param)
  },
  watch: {
    reload: {
      handler() {
        this.queryParam = Object.assign({}, this.param)
        this.dataSource = []
        if (this.queryParam.orgId != '' && this.queryParam.vchId != '' && this.queryParam.arrayTime.length > 0) {
          this.url.list = this.list
          this.loadData(1)
        }
      },
      immediate: true
    },
    reload2: {
      handler() {
        this.queryParam = Object.assign({}, this.param)
        this.dataSource = []
        if (this.queryParam.id) {
          this.url.list = this.list
          this.loadData(1)
        }
      },
      immediate: false
    }
  },
  data() {
    return {
      //   disableMixinCreated: true
      url: {
        list: ''
      },
      disableMixinCreated: true
    }
  },
  methods: {
    CheckDetail(record) {
      this.$emit('CheckDetail', record)
    }
  }
}
</script>

<style lang="less" scoped>
@import '~@assets/less/tableTheme.less';
</style>
